using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class 暂停键 : MonoBehaviour
{
    public Button pause_button;
    bool stop = true;
    // Start is called before the first frame update
    public void PauseGame()
    {
        Time.timeScale = 0;
        stop = false;
    }
    public void ResumeGame()
    {
        Time.timeScale = 1;
        stop = true;
    }
    void Start()
    {
    
    }

    // Update is called once per frame
    void Update()
    {
        if (stop == true)
        {
            pause_button.onClick.AddListener(PauseGame);
        }
        if (stop == false)
        {
            pause_button.onClick.AddListener(ResumeGame);
        }
    }
}
